package approve.dao;

import java.sql.CallableStatement;
import java.sql.Types;

import models.util.MySqlDataAccessHelper;

public class ReceiverDocumentDAO {
	
	public int countAllNewMessage(String employeeID, String databasename) {
		MySqlDataAccessHelper helper = new MySqlDataAccessHelper();
		CallableStatement cs = null;
		String sql = "call android_countAllNewMessage(?,?)";
		int kq = -1;
		try {
			helper.open(databasename);
			cs = helper.getConnection().prepareCall(sql);
			cs.setString(1, employeeID);
			cs.registerOutParameter(2, Types.INTEGER);
			cs.execute();
			kq=cs.getInt(2);
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				if(helper.getConnection() != null){
					helper.close();
				}
				if (cs != null) {
					cs.close();   	
	            }
			} catch (Exception e) {
				e.printStackTrace();
			}   
		}
		return kq;
	}
}